#ifndef _CROTATIONCONTROL_H_
#define _CROTATIONCONTROL_H_

#include "CGlobals.h"
#include "IControl.h"
#include "IrrArray.h"
#include "quaternion.h"
#include "vector2d.h"
#include "SColor.h"

class CRotationControl : public IControl
{
	CRotationControl (); // no default constructor
	CRotationControl (const CRotationControl&); // no copy constructor
	CRotationControl& operator= (const CRotationControl&); // no assignment

public:
	CRotationControl (array<ISceneNode*> node, vector3df axis1, vector3df axis2, SColor normalColor, SColor highlightColor);
	virtual ~CRotationControl ();

	virtual bool OnEvent (const SEvent& event);
	virtual void draw ();

	bool isUsable () const;

private:
	array<ISceneNode*> m_nodes;
	vector3df m_axis1;
	vector3df m_axis2;
	SColor m_normalColor;
	SColor m_highlightColor;
	bool m_activated;
	bool m_highlighted;
	array<vector3df> m_nodesStartPos;
	array<quaternion> m_nodesStartRot;
	vector3df m_centroid;
	vector3df m_mouseStartPos;

	void getScreenCoordinates (array<vector2df>* coordinates) const;
	bool onMouseEvent (const SEvent::SMouseInput& event);
	bool isPointOverControl (position2di pt) const;

	vector3df m_absCentroid;
};

#endif
